<?php
/**
 * Copyright (c) [2019] [吴跃忠]
 * [selibra] is licensed under the Mulan PSL v1.
 * You can use this software according to the terms and conditions of the Mulan PSL v1.
 * You may obtain a copy of Mulan PSL v1 at:
 * http://license.coscl.org.cn/MulanPSL
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
 * PURPOSE.
 * See the Mulan PSL v1 for more details.
 */

namespace Selibra\WebSocket;


use Selibra\WebSocket\Protocols\MessageInputInterface;
use Swoole\WebSocket\Frame;
use Swoole\WebSocket\Server;

class Message
{

    /**
     * @var Server
     */
    protected Server $server;


    /**
     * @var Frame
     */
    protected Frame $frame;


    /**
     * @var MessageInputInterface
     */
    protected MessageInputInterface $messageInput;


    /**
     * @var Response
     */
    protected Response $response;


    /**
     * @return Server
     */
    public function getServer(): Server
    {
        return $this->server;
    }

    /**
     * @param Server $server
     */
    public function setServer(Server $server): void
    {
        $this->server = $server;
    }

    /**
     * @return Frame
     */
    public function getFrame(): Frame
    {
        return $this->frame;
    }

    /**
     * @param Frame $frame
     */
    public function setFrame(Frame $frame): void
    {
        $this->frame = $frame;
    }

    /**
     * @return MessageInputInterface
     */
    public function getMessageInput(): MessageInputInterface
    {
        if (!isset($this->messageInput)) {
            return null;
        }
        return $this->messageInput;
    }

    /**
     * @param MessageInputInterface $messageInput
     */
    public function setMessageInput(MessageInputInterface $messageInput): void
    {
        $this->messageInput = $messageInput;
    }

    /**
     * @return Response
     */
    public function getResponse(): Response
    {
        return $this->response;
    }

    /**
     * @param Response $response
     */
    public function setResponse(Response $response): void
    {
        $this->response = $response;
    }


}